﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Diagnostics;

namespace WpfWindowEventView
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        const string formatWithTime = "{0} | {1} ";
        const string formatTimeWithMilliSecond = "HH:mm:ss fff";
        public MainWindow()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
            this.ContentRendered += new EventHandler(MainWindow_ContentRendered);
            this.Activated += new EventHandler(MainWindow_Activated);
            this.Deactivated += new EventHandler(MainWindow_Deactivated);
            this.Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing);
            this.Unloaded += new RoutedEventHandler(MainWindow_Unloaded);
            this.Closed += new EventHandler(MainWindow_Closed);
        }

        void Write(string info)
        {
            Trace.WriteLine(string.Format(formatWithTime, DateTime.Now.ToString(formatTimeWithMilliSecond), info));
        }

        void MainWindow_Closed(object sender, EventArgs e)
        {
            Write("MainWindow_Closed");
        }

        void MainWindow_Unloaded(object sender, RoutedEventArgs e)
        {
            Write("MainWindow_Unloaded");
        }

        void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Write("MainWindow_Closing");
        }

        void MainWindow_Deactivated(object sender, EventArgs e)
        {
            Write("MainWindow_Deactivated");
        }


        void MainWindow_Activated(object sender, EventArgs e)
        {
            Write("MainWindow_Activated");
        }

        void MainWindow_ContentRendered(object sender, EventArgs e)
        {
            Write("MainWindow_ContentRendered");
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Write("MainWindow_Loaded");
        }
    }
}
